﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using SD.Database.Classes;

namespace smallDeimos.Game.GameTools
{
    public partial class TravelTime : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            int xa = int.Parse(FromSysX.Text);
            int xb = int.Parse(ToSysX.Text);
            int ya = int.Parse(FromSysY.Text);
            int yb = int.Parse(ToSysY.Text);
            int en = int.Parse(Energy.Text);
            int s = int.Parse(Speed.Text);
            int pa = int.Parse(FromPlanet.Text);
            int pb = int.Parse(ToPlanet.Text);

            double tt = Equations.TravelTime(xa, xb, ya, yb, pa, pb, 1, en, s);
            int h = (int)tt;
            int m = (int)(tt - h * 1.0) ;
            int sec = (int)(tt - h * 1.0 - m * 1.0);
            TTSame.Text = h.ToString() + "h " + m.ToString() + "m " + sec.ToString() + "s";

            tt = Equations.TravelTime(xa, xb, ya, yb, pa, pb, 0, en, s);
            h = (int)tt;
            m = (int)(tt - h * 1.0) ;
            sec = (int)(tt - h * 1.0 - m * 1.0);
            TTNorm.Text = h.ToString() + "h " + m.ToString() + "m " + sec.ToString() + "s";
        }
    }
}
